﻿(function () {
    'use strict';
    var app = angular.module('app');

    app.controller("personReferralsScheduleCtrl", ["$scope", "$routeParams", "scheduleService", function ($scope, $routeParams, scheduleService) {
        $scope.personId = $routeParams.personId;
        $scope.records = [];
        scheduleService.getScheduleByPerson($scope.personId).then(function(result) {
            $scope.records = result;
        });

        $scope.deleteAppointment = function(record) {
            console.log(record);
            scheduleService.clearAppointment(record.id, "").
                        then(function (result) {
                            //$scope.records.remove(record);
                        });
        };
    }]);

}());
